<template>
  <div class="my">my</div>
  <view>
    <view>
	<uni-calendar 
	ref="calendar"
	:insert="false"
	:start-date=start_date
	:range="true"
	@confirm="confirm"
	:selected="selectf"
	:disableDay="['2023-09-15','2023-09-17']"
	
	 />
	 <button @click="open">打开日历</button>
</view>
  </view>
  <navigator
    url="/pages/detail/detail"
    open-type="navigate"
    hover-class="navigator-hover"
  >
  <view>调整</view>
  </navigator>
</template>

<script setup lang="ts">
import { ref } from 'vue';
import { onLoad } from '@dcloudio/uni-app';
const calendar=ref(null)
//const start_date=ref('2023-9-11')

const open=()=>{
calendar.value.open()
}

const confirm = (e)=>{
	console.log(e)
}
const getDate=(date, AddDayCount = 0)=> {
		if (!date) {
			date = new Date()
		}
		if (typeof date !== 'object') {
			date = date.replace(/-/g, '/')
		}
		const dd = new Date(date)

		dd.setDate(dd.getDate() + AddDayCount) // 获取AddDayCount天后的日期

		const y = dd.getFullYear()
		const m = dd.getMonth() + 1 < 10 ? '0' + (dd.getMonth() + 1) : dd.getMonth() + 1 // 获取当前月份的日期，不足10补0
		const d = dd.getDate() < 10 ? '0' + dd.getDate() : dd.getDate() // 获取当前几号，不足10补0
		return {
			fullDate: y + '-' + m + '-' + d,
			year: y,
			month: m,
			date: d,
			day: dd.getDay()
		}
	}
const selectf=ref([

	{
						date: '2023-09-10',
						info: '已预定',
						data: {
							custom: '自定义信息',
							name: '自定义消息头'
						}
					}
	
])

const start_date=getDate(new Date()).fullDate
// onLoad(()=>{
// 	select.value=
// })
</script>
<script></script>
